<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        li {
            list-style: none;
        }
        a {
            text-decoration:none;
        }
        .nav {
            background: url('imgs/bg.jpg');
            width: 340px;
            height: 30px;
        }
        .nav >ul {
            margin-left: 10px;
        }
        .nav >ul>li {
            float: left;
            margin-right: 10px;
            width: 100px;
            height: 30px;
            background: url('imgs/libg.jpg');
            text-align: center;
            line-height: 30px;
            position: relative;
        }
        .nav >ul>li ul {
            position: absolute;
            left: 0;
            top: 30px;
            /* display: none; */
            overflow: hidden;
            height: 0;
        }
        .nav >ul>li li {
            width: 100px;
            height: 30px;
            background: url('imgs/libg.jpg');
            text-align: center;
            line-height: 30px;
        }
    </style>
</head>
<body>
    <div class="nav">
        <ul>
            <li>
                <a href="javascript:void(0)">一级菜单</a>
                <ul>
                    <li>二级菜单</li>
                    <li>二级菜单</li>
                    <li>二级菜单</li>
                </ul>
            </li>
            <li>
                <a href="javascript:void(0)">一级菜单</a>
                <ul>
                    <li>二级菜单</li>
                    <li>二级菜单</li>
                    <li>二级菜单</li>
                </ul>
            </li>
            <li>
                <a href="javascript:void(0)">一级菜单</a>
                <ul>
                    <li>二级菜单</li>
                    <li>二级菜单</li>
                    <li>二级菜单</li>
                </ul>
            </li>
        </ul>
    </div>
</body>
<script src='../common.js'></script>
<script>
    //获取元素
    var liList = document.querySelectorAll('.nav>ul>li');
    var ul = document.querySelector('.nav>ul>li>ul');

    //注册事件
    for(var i = 0; i < liList.length; i++) {
        liList[i].onmouseenter = liMouseenter
        liList[i].onmouseleave = liMouseleave

    }
    function liMouseenter(){
        animationAll(this.lastElementChild,{height:90})   
    }
    function liMouseleave(){
        animationAll(this.lastElementChild,{height:0})
    }

</script>
<!-- <script src='../jquery-1.12.4.js'></script> -->
<script>
    // $(function(){
    //     $('.nav>ul>li').on('mouseenter',function(){
    //         $(this).children('ul').stop(true,false).slideDown(500)
    //     }).on('mouseleave',function(){
    //         $(this).children('ul').stop(true,false).slideUp(500)
    //     })
    // })
</script>
</html>